#ifndef COMPONENTASSEMBLER_H
#define COMPONENTASSEMBLER_H

#include "ModelComponent.h"
#include <memory>
#include <vector>

class CComponentAssembler
{
public:
    CComponentAssembler();
    
    wxString AssembleModel(const std::vector<std::shared_ptr<CModelComponent>>& components);
    bool ValidateAssembly(const std::vector<wxString>& componentNames) const;
    
    std::vector<wxString> ResolveDependencies(const wxString& componentName);
    bool CheckCircularDependencies(const std::vector<wxString>& components);
    
    std::vector<wxString> OptimizeComponentOrder(const std::vector<wxString>& components);
    std::vector<wxString> RemoveRedundantComponents(const std::vector<wxString>& components);

private:
    std::map<wxString, std::shared_ptr<CModelComponent>> m_componentRegistry;
    
    void TopologicalSort(std::vector<wxString>& components);
    bool DependencySatisfied(const wxString& component, const std::vector<wxString>& available);
};

#endif
